package com.xm.util;

import java.util.Random;

/**
 * @author xie'lin'feng
 * @date 2020-08-25-10:26
 * @description 随机数工具类
 */
public class RandomUtil {
    public static String RandomCode(int length){
        String str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        StringBuilder sb=new StringBuilder(length);
        for(int i=0;i<length;i++)
        {
            char ch=str.charAt(new Random().nextInt(str.length()));
            sb.append(ch);
        }
        return sb.toString();
    }
}
